package com.wkhyapp.lm.view;

import android.os.Build;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.wkhyapp.lm.MainActivity;
import com.wkhyapp.lm.R;
import com.wkhyapp.lm.base.BaseActivity;
import com.wkhyapp.lm.base.SuperActivity;
import com.wkhyapp.lm.contract.MyPresenter;
import com.wkhyapp.lm.contract.MyView;
import com.wkhyapp.lm.http.vo.Member;
import com.wkhyapp.lm.utils.MemberUtils;
import com.wkhyapp.lm.utils.PreferenceUtils;
import com.wkhyapp.lm.utils.StatusBarFontUtil;

public class StartActivity extends SuperActivity<MyPresenter>   implements MyView{


    @Override
    public void initUI() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            translucentStatusBar();
        }
        StatusBarFontUtil.setLightStatusBarColor(this);

        if (!isTaskRoot()) {
            finish();
            return ;
        }
    }

    @Override
    protected void afterCreate() {
    }

    @Override
    protected MyPresenter createPresenter() {
        return mPresenter = new MyPresenter(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_start;
    }

    @Override
    protected void initListener() {
        if(!PreferenceUtils.getInstance().getPrefBoolean("init",false)){
             // TToast("调用");
             mPresenter.init();
        }
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                goTo(MainActivity.class);
                finish();
            }
        },3000);

    }

    @Override
    public void setMember(Member member) {
        PreferenceUtils.getInstance().getPrefBoolean("init",true);
    }
}
